
<!--
/**************************************************
* @ providerdetail.jsp
*
* Copyright   2005 Hitrust Technology Inc.
* Developed by SDC, Hitrust.
* All Rights Reserved.
*
* Modify History:
*  v1.00, 2006/02/27, owen
*  1) first release
/**************************************************
-->
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ include file="../common.jsp" %>
<%@ page import="framework.core.ConstDefine"%>
<html>
<head>
<title>供应商浏览</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<LINK href="<%=root%>/css/caigouxitong.css" type=text/css rel=stylesheet>
<SCRIPT language="JavaScript" src="<%=root%>/js/common.js"></SCRIPT>
<SCRIPT language="JavaScript" src="<%=root%>/js/hi-check.js"></SCRIPT>
<%
String exceptiondesc = (String)request.getAttribute("exception_desc");
if(message == null){
	ArrayList tGSCountry = (ArrayList)request.getAttribute("country");
	ArrayList tGSProvince = (ArrayList)request.getAttribute("province");
	GSProvinceBean tProvinceBean = null;
	String[][] tProvDist = null;
	HashMap tMap2 = new HashMap();
	ArrayList tGSDistinct = (ArrayList)request.getAttribute("district");	
	GSDistrictBean tDistrictBean = null;
	if (tGSProvince != null) {
		for (int i = 0; i < tGSProvince.size(); i++) {
			String tProvcode = ((GSProvinceBean) tGSProvince.get(i)).getGs_province_code();
			if (tGSDistinct != null) {
				tProvDist = new String[tGSDistinct.size()][2];
				for (int j = 0; j < tGSDistinct.size(); j++) {
					tDistrictBean = (GSDistrictBean) tGSDistinct.get(j);
					if (tDistrictBean.getGs_province_code().equals(tProvcode)) {
						tProvDist[j][0] = tDistrictBean.getGs_district_code();
						tProvDist[j][1] = tDistrictBean.getGs_district_name();
						tMap2.put(tProvcode, tProvDist);
					}//end if
				}//end for
			}//end if
		}//end for
	}//end if	
	
	ResultProcess tGSProvider = (ResultProcess)request.getAttribute("provider");
	String[][] tGSCorpProperty = (String[][])request.getAttribute("corpproperty");
	ArrayList tList = new ArrayList();

	String MaxProviderId=(String)request.getAttribute("MaxProviderID");
	int getProviderID=Integer.parseInt(MaxProviderId)+1;
%>

<script language="JavaScript">
   <%if(exceptiondesc!=null){%>
   alert("<%=exceptiondesc%>");
   <%}%>
	var counter;
	
	function getCheckedRadioValue(radioName) {
		var radios = document.getElementsByName(radioName);
		for(var i=0; i<radios.length; i++) {
			if(radios[i].checked) {
				return radios[i].value;
			}
		}
	}
	
	function check(){
	   var iFields1 = new Array(3);
        iFields1[0] = 'gs_provider_id||供应商编号||Y||1-10||#0';
        iFields1[1] = 'gs_provider_shortname||供应商简称||Y||1-50||##';
        iFields1[2] = 'gs_provider_name||供应商名称||Y||1-100||##';
       
        
		if( HiScript.value(checkform.name,iFields1) == false)  return false;
	    
	    if(document.all.gs_corp_property.value == "0" || document.all.gs_corp_property.value == ""){
			alert("请选择公司性质！");
			return false;
		}
	    if(document.all.gs_reside_province.value == "00" || document.all.gs_reside_province.value == ""){
			alert("请选择省份！");
			return false;
		}
		var ary = new Array(19);
            ary[0] = checkform.gs_provider_id.value;
            ary[1] = checkform.gs_provider_shortname.value;
            ary[2] = checkform.gs_provider_name.value;
            ary[3] = checkform.gs_provider_engname.value;
            ary[4] = checkform.gs_corp_property.value;
            ary[5] = checkform.gs_credit_level.value;
            ary[6] = checkform.gs_corp_addr.value;
            ary[7] = checkform.gs_corp_post.value;
            ary[8] = checkform.gs_principal_id.value;
            ary[9] = checkform.gs_principal_phone.value;
            ary[10] = checkform.gs_contact_id.value;
            ary[11] = checkform.gs_contact_phone.value;
            ary[12] = checkform.gs_reside_country.value;
            ary[13] = checkform.gs_reside_province.value;
            ary[14] = checkform.gs_reside_city.value;
            ary[15] = checkform.gs_work_trade.value;
            ary[16] = checkform.gs_work_manufacture.value;
            ary[17] = checkform.gs_work_scope.value;
            ary[18] = getCheckedRadioValue("isAudit");
    	window.returnValue = ary;
	    window.close();

	}
    
    function back(){
		 self.close();
	}
    
    function changedistrict(list){
		
  		var val = list;
		if(val=='00'){
			var listbox = document.getElementById("list3");
			listbox.length = 0;
			var option = new Option();
			option.text = "---请选择城市---";
			option.value = "0000";			
			listbox.options[listbox.length] = option;

		}else{
  	<%
  		if(tMap2 !=null){
	 	   	Collection tCollection = tMap2.keySet();
	        Iterator tIterator = tCollection.iterator();
  		       while(tIterator.hasNext()){
  		           String tKey = (String)tIterator.next();
  		           String[][] tDist = (String[][])tMap2.get(tKey);
  	%>
  				if(val == '<%=tKey%>'){
	  				var counter;
	  				var listbox = document.getElementById("list3");
	  				listbox.length = 0;  		  	  								
	<%					
						for(int n=0;n<tDist.length;n++){
						    String distCode = tDist[n][0];
						    String distName = tDist[n][1];
						    if(distCode != null){
	%>				
							var temp1 = '<%=distCode%>';
							var temp2 = '<%=distName%>';
							var option = new Option();
							option.value = temp1;
							option.text = temp2;
							listbox.options[listbox.length] = option;						
	<%
						    }
						}
	%>
  				}
  	<%
  		    }
  		       
  		}
  	%>
  	}	
	}
</script>
</head>
<body onload="document.checkform.gs_provider_name.focus();" BGCOLOR="#f2f2f2"	text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="checkform" method="post">
<p><br></p>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr>
		<td height="20">
		<table width="100%" border="0" cellspacing="0" cellpadding="1">
			<tr height="20">
				<td height="20" width="1" class="mtxt_black">&nbsp;</td>
				<td height="30" width="758" class="mtxt_black">新增供应商</td>
			</tr>
		</table>
		</td>
	</tr>
	<tr>
		<td class="bg_line" height="2"></td>
	</tr>
</table>
<br>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr> 
		<td> 
			<table class=bg_table id=tableId	cellspacing=1 cellpadding=0 style="padding-left:5;padding-right:5" width=100% align=center border=0>
				<TR height=20>
					<TD class="bg_row_odd" align=center width="20%">供应商编号</TD>
					<TD align=left class="bg_row_odd" width="30%">
					<input type=text value="<%=getProviderID%>" name="gs_provider_id" maxlength="10" size=30 disabled/>
					</TD>					
					<TD class="bg_row_odd" align=center width="20%">供应商简称</TD>
					<TD align=left class="bg_row_odd" width="30%">
					<input type=text name="gs_provider_shortname" maxlength="50" size=30/>
					<font color='red'>&nbsp;*</font>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_row_odd" align=center>供应商名称</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_provider_name" maxlength="100" size=30/>
					<font color='red'>&nbsp;*</font>
					</TD>									
					<TD class="bg_row_odd" align=center>供应商英文名称</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_provider_engname" maxlength="100" size=30/>
					</TD>
				</TR>
				<tr>
					<TD class="bg_row_odd" align=center>公司性质</TD>
					<TD align=left class="bg_row_odd" >
					<select name="gs_corp_property">	
						<option value="0">---全部---</option>				
						<%
							if(tGSCorpProperty != null && tGSCorpProperty.length > 0){
								for(int i=0; i<tGSCorpProperty.length; i++){
									String[] tStr = tGSCorpProperty[i];
									//if(tProperty != null && tProperty.equals(tStr[0])){
						%>
								<option value="<%=tStr[1]%>"><%=tStr[1]%></option>
						<%			
								}
							}
						%>

						</select>
						<font color='red'>&nbsp;*</font>
					</TD>					
					<TD class="bg_row_odd" align=center>信誉等级</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_credit_level" maxlength="100" size=30/>
					</TD>					
				</TR>
				<TR height=20>
					<TD class="bg_row_odd" align=center>经营地址</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_corp_addr" maxlength="100" size=30/>
					</TD>					
					<TD class="bg_row_odd" align=center>邮政编码</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_corp_post" maxlength="100" size=30/>
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_row_odd" align=center>负责人</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_principal_id" maxlength="100" size=30/>
					</TD>					
					<TD class="bg_row_odd" align=center>负责人电话</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_principal_phone" maxlength="100" size=30/>
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_row_odd" align=center>联系人</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_contact_id" maxlength="100" size=30/>
					</TD>					
					<TD class="bg_row_odd" align=center>联系人电话</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_contact_phone" maxlength="100" size=30/>
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_row_odd" align=center>所属国家</TD>
					<TD align=left class="bg_row_odd">
					<select name="gs_reside_country">					
						<%
							if(tGSCountry != null && tGSCountry.size() > 0 ){
								for(int i=0; i<tGSCountry.size(); i++){
								    GSCountryBean tGSCountryBean = (GSCountryBean)tGSCountry.get(i);

						%>
								<option value="<%=tGSCountryBean.getGs_en_country_name()%>"><%=tGSCountryBean.getGs_en_country_name()%>|<%=tGSCountryBean.getGs_country_name()%></option>
						<%			
								}
							}else{
						%>
								<option value="00">------无------</option>
						<%
							}
						%>
						</select>
					</TD>					
					<TD class="bg_row_odd" align=center>所属省份</TD>
					<TD align=left class="bg_row_odd">
					<select name="gs_reside_province" onChange="changedistrict(this.value)">	
						<option value="00">---请选择省份---</option>				
						<%
							String tProvCode = request.getParameter("provinceCode");
							if(tGSProvince != null && tGSProvince.size() > 0 ){
								for(int i=0; i<tGSProvince.size(); i++){
								    GSProvinceBean tGSProvinceBean = (GSProvinceBean)tGSProvince.get(i);
								   // if(tProvCode != null && tProvCode.equals(tGSProvinceBean.getGs_province_code())){
						%>
								<option value="<%=tGSProvinceBean.getGs_province_code()%>"><%=tGSProvinceBean.getGs_province_name()%></option>
								
						<%	
						    }	
						}
							
						%>

						</select>	
						<font color='red'>&nbsp;*</font>				
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_row_odd" align=center>所属城市</TD>
					<TD align=left class="bg_row_odd">
					<select name="gs_reside_city" id="list3">	
						<option value="0000">---请选择城市---</option>	
						
																		
						</select>
					</TD>					
					<TD class="bg_row_odd" align=center>主营行业</TD>
					<TD align=left class="bg_row_odd">
					<input type=text name="gs_work_trade" maxlength="100" size=30/>
					
					</TD>					
				</TR>				
				<TR height=20>
					<TD class="bg_row_odd" align=center >主营产品</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					<TEXTAREA rows=5 style="width:98%" cols=20 name=gs_work_manufacture></TEXTAREA>
					</TD>					
										
				</TR>
				<TR height=20>	
				    <TD class="bg_row_odd" align=center >所属范围</TD>
					<TD align=left class="bg_row_odd" colspan="3">
					    <TEXTAREA rows=5 style="width:98%" cols=20 name=gs_work_scope></TEXTAREA>
					</TD>		
				</TR>		
				
				<TR>
				  <TD class="bg_row_odd" align=center>是否审核类：</TD>
					<TD left=right class="bg_row_odd" colspan="3">
						<input type="radio" name="isAudit" value="<%=ConstDefine.STR_YES %>"> 是 
						<input type="radio" name="isAudit" value="<%=ConstDefine.STR_NO %>" checked> 否
					</TD>
				</TR>												
			</table>
		</td>
	</tr>
</table>
</form>
    <p align="center">  
		<input type="button" class="kuang" value="增加" onclick="return check();"> 
		<input type="button" class="kuang" value="关闭" onclick="return back();"/>&nbsp;		
    </p>
<%
 }
%>
</body>
</html>